<?php use_helper('I18N') ?>
<?php //use_helper('crossAppLink') ?>
<?php

function cross_app_url_for($appname, $url, $absolute = false, $env = null, $debug = false) {

    $initial_app = sfContext::getInstance()->getConfiguration()->getApplication();
    $initial_web_controler = basename(sfContext::getInstance()->getRequest()->getScriptName());
    $initial_config = sfConfig::getAll();
    // get the environment
    if (is_null($env)) {
        $env = sfContext::getInstance()->getConfiguration()->getEnvironment();
    }

    // context creation
    if (!sfContext::hasInstance($appname)) {
        $context = sfContext::createInstance(ProjectConfiguration::getApplicationConfiguration($appname, $env, $debug), $appname);
    } else {
        $context = sfContext::getInstance($appname);
    }
    $web_url = $context->getController()->genUrl($url, $absolute);
    sfContext::switchTo($initial_app);
    sfConfig::add($initial_config);
    unset($context);

    //remove initial web controler
    // genUrl use $this->context->getRequest()->getScriptName();, its a call to $_SERVER
    // so starting the shameless part !
    $script_name = $appname;
    if (($env != 'prod') and $env) {
        $script_name.='_' . $env;
    } elseif ($script_name == "frontend") {
        $script_name = "index";
    }
    $script_name.='.php';
    // check if this file exist
    if (!file_exists(sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . $script_name))
        throw new sfException('can t find ' . $script_name . ' in the web directory');
    $web_url = str_replace($initial_web_controler, $script_name, $web_url);

    return $web_url;
}
?>
<div align="center"><h1><b>USUARIO SIN PERMISOS ADMINISTRATIVOS</b></h1></div><br>

<div align="center">

    <div id="fondousuariosinpermisos" align="center"> 
        <div class="spritesuserwithoutpermission" id="userwithoutpermission_jpg" align="center"></div>
    </div>

    <h2><b><?php echo __('Lo sentimos no tiene acceso a la página del administrador.', null, 'sf_guard') ?></b></h2><br>

    <h3><b><?php echo __('Regresar a la página Principal del Administrador e ingrese con un usuario administrador', null, 'sf_guard') ?></b></h3><br>

    <a href="<?php echo url_for('SfGuardAuth/Signout') ?>"><button class="button2 button-azul"><span><div class="spritesadministrador" id="administrador_jpg" align="center"></div>Ir al Login Administrador</span></button></a>&nbsp;<a href="<?php echo cross_app_url_for('frontend', 'inicio/index') ?>">Ir a tu cuenta</a><br>

<?php //echo get_component('sfGuardAuth', 'signin_form')  ?>

</div>